<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <title>Document</title>
    <style>
        .active{
            width: 200px;
        }
    </style>
</head>
<body>
    <div id="app">
        当前分数：<span>{{count}}</span>
        <button v-on:click="add">+</button>  <!-- @就是v-on的缩写 -->
        <button @click="reduce">-</button>  
        <hr>
        <!-- <input type="text" v-on:keyup.enter="enter"> -->
        <input type="text" v-model.trim="inputVal" v-on:keyup.enter="enter">
        <p>input的value值：{{inputVal}}</p>
        <hr>
        <!-- <img v-bind:src="imgUrl" alt=""> -->
        <!-- :相当于v-bind -->
        <img :src="imgUrl" :class="isOk ? 'active' : ''" alt="">

    </div>
    <script>

        let app = new Vue({
            el: '#app',
            data: {
                count: 0,
                inputVal: 0,
                imgUrl:'https://img0.baidu.com/it/u=1967997459,1022958762&fm=26&fmt=auto',
                className: 'active',
                isOk:true
            },
            methods: {
                add() {
                    this.count++
                },
                reduce() {
                    this.count--
                },
                enter(e) {
                    // console.log(e);
                    if(e.keyCode==13){
                    console.log(123);
                }

                }
            }
        })
    </script>
</body>
</html>